package edu.mbb.mybatis;

import java.lang.reflect.Proxy;
import java.sql.SQLException;

import edu.mbb.annocation.Service;

@Service
public class MyDefalutSqlSession implements MySqlSession {

	private MyExecutor executor = new MyBaseExecutor();

	@Override
	public <T> T selectOne(String sql, Class<?> returnType, String methodName) throws SQLException {
		return executor.query(sql, returnType, methodName);
	}

	@Override
	public <T> T getMapper(Class<T> clazz) {
		return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class[] { clazz }, new MyMapperProxy(this));
	}
}
